package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

@Mapper
public interface UserMapper {

    @Select("select id, openid, name, phone from user where openid = #{openid};")
    public User getByOptionid(String openid);

    @Insert("insert into user(id, openid, name,create_time) VALUE(#{id}, #{openid}, #{name},#{createTime})")
    public void addUser(User user);

    @Select("select * from user where id = #{id}")
    User getById(Long id);

    @Select("select count(*) from user where create_time like concat(#{date},'%')")
    int count(String date);

}
